package cn.wolfcode.trip.base.domain;

import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * 用户购买的商品表
 */
@Setter@Getter
public class UserGoods extends BaseDomain{

    public static final Integer STATE_DSHOPPING_CART = 1;//购物车
    public static final Integer STATE_SHIPPED = 2;//待收货
    public static final Integer STATE_UNSHIPPED = 3;//已收货


    private User user;//购买人

    private Store store;//购买的商品

    private Integer state;//状态

    private String place;//收货人地址

    private Integer number;//购买数量

    private String size;//尺码
    private String name;//姓名
    private String tel;//联系方式
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date buyTime;//购买时间
    private String remarks;//备注
    private Long[] arrays;

    public String getStateName(){
        String temp="购物车";
         if (state==2){
             temp="待收货";
         }
         if (state==3){
             temp="已收货";
         }
         return temp;
    }
}